package com.allwees.bs.module.oms.util;

import com.allwees.bs.module.oms.entity.Order;
import com.allwees.bs.module.oms.entity.OrderFlow;


public class OrderUtil {

    /**
     * 流转订单
     *
     * @param order 订单实体
     * @return 订单流转记录实体
     */
    public static OrderFlow flowOrder(Order order) {
        OrderFlow orderFlow = new OrderFlow();
        orderFlow.setOrderUuid(order.getUuid());
        orderFlow.setAction(order.getLatestAction());
        orderFlow.setBackState(order.getBackState());
        orderFlow.setState(order.getState());
        return orderFlow;
    }


    public static Order generateShipped(Order order, Integer weight) {

        Order updateOrder = new Order();
        updateOrder.setId(order.getId());
        updateOrder.setState(order.getState());
        updateOrder.setLatestAction(order.getLatestAction());
        updateOrder.setBackState(order.getBackState());

        return updateOrder;
    }
}
